package com.ruoyi.web.controller.ydz;

import java.util.List;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.web.domain.JapanDisease;
import com.ruoyi.web.service.IJapanDiseaseService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 【疾病管理】Controller
 * 
 * @author drx
 * @date 2025-05-09
 */
@Controller
@RequestMapping("/ydz/japanDisease")
@Api(tags = "【疾病管理】")
public class JapanDiseaseController extends BaseController
{
    private String prefix = "ydz/japanDisease";

    @Autowired
    private IJapanDiseaseService japanDiseaseService;

    @RequiresPermissions("ydz:japanDisease:view")
    @GetMapping()
    public String disease()
    {
        return prefix + "/japanDisease";
    }

    @GetMapping("/doctorDisease")
    public String lcLeaveWord()
    {
        return "ydz/doctorDisease/doctorDisease";
    }

    /**
     * 查询【疾病管理】列表
     */
    @RequiresPermissions("ydz:japanDisease:list")
    @PostMapping("/list")
    @ResponseBody
    @ApiOperation("查询【疾病管理】列表")
    public TableDataInfo list(JapanDisease japanDisease)
    {
        startPage();
        List<JapanDisease> list = japanDiseaseService.selectJapanDiseaseList(japanDisease);
        return getDataTable(list);
    }

    /**
     * 导出【疾病管理】列表
     */
    @RequiresPermissions("ydz:japanDisease:export")
    @Log(title = "【疾病管理】", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    @ApiOperation("导出【请填写功能名称】列表")
    public AjaxResult export(JapanDisease japanDisease)
    {
        List<JapanDisease> list = japanDiseaseService.selectJapanDiseaseList(japanDisease);
        ExcelUtil<JapanDisease> util = new ExcelUtil<JapanDisease>(JapanDisease.class);
        return util.exportExcel(list, "【疾病管理】数据");
    }

    /**
     * 新增【疾病管理】
     */
    @GetMapping("/add")
    @ApiOperation("新增【疾病管理】")
    public String add()
    {
        return prefix + "/add";
    }

    @GetMapping("doctorDisease/add")
    public String doctorDiseaseadd()
    {
        return "ydz/doctorDisease/add";
    }

    /**
     * 新增保存【疾病管理】
     */
    @ApiOperation("新增保存【疾病管理】")
    @RequiresPermissions("ydz:japanDisease:add")
    @Log(title = "【疾病管理】", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(JapanDisease japanDisease)
    {
        return toAjax(japanDiseaseService.insertJapanDisease(japanDisease));
    }

    /**
     * 修改【疾病管理】
     */
    @ApiOperation("修改【疾病管理】")
    @RequiresPermissions("ydz:japanDisease:edit")
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        JapanDisease japanDisease = japanDiseaseService.selectJapanDiseaseById(id);
        mmap.put("japanDisease", japanDisease);
        return prefix + "/edit";
    }

    /**
     * 修改保存【疾病管理】
     */
    @ApiOperation("修改保存【疾病管理】")
    @RequiresPermissions("ydz:japanDisease:edit")
    @Log(title = "【疾病管理】", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(JapanDisease japanDisease)
    {
        return toAjax(japanDiseaseService.updateJapanDisease(japanDisease));
    }

    /**
     * 删除【疾病管理】
     */
    @ApiOperation("删除【疾病管理】")
    @RequiresPermissions("ydz:japanDisease:remove")
    @Log(title = "【疾病管理】", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(japanDiseaseService.deleteJapanDiseaseByIds(ids));
    }
}
